package com.ruoyi.project.system.student.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.system.student.mapper.ClassStudentMapper;
import com.ruoyi.project.system.student.domain.ClassStudent;
import com.ruoyi.project.system.student.service.IClassStudentService;
import com.ruoyi.common.utils.text.Convert;

/**
 * 班级-学生关联Service业务层处理
 *
 * @author ruoyi
 * @date 2021-04-15
 */
@Service
public class ClassStudentServiceImpl implements IClassStudentService
{
    @Autowired
    private ClassStudentMapper classStudentMapper;

    /**
     * 查询班级-学生关联
     *
     * @param id 班级-学生关联ID
     * @return 班级-学生关联
     */
    @Override
    public ClassStudent selectClassStudentById(Long id)
    {
        return classStudentMapper.selectClassStudentById(id);
    }

    /**
     * 查询班级-学生关联列表
     *
     * @param classStudent 班级-学生关联
     * @return 班级-学生关联
     */
    @Override
    public List<ClassStudent> selectClassStudentList(ClassStudent classStudent)
    {
        return classStudentMapper.selectClassStudentList(classStudent);
    }

    /**
     * 新增班级-学生关联
     *
     * @param classStudent 班级-学生关联
     * @return 结果
     */
    @Override
    public int insertClassStudent(ClassStudent classStudent)
    {
        classStudent.setCreateTime(DateUtils.getNowDate());
        return classStudentMapper.insertClassStudent(classStudent);
    }

    /**
     * 修改班级-学生关联
     *
     * @param classStudent 班级-学生关联
     * @return 结果
     */
    @Override
    public int updateClassStudent(ClassStudent classStudent)
    {
        classStudent.setUpdateTime(DateUtils.getNowDate());
        return classStudentMapper.updateClassStudent(classStudent);
    }

    /**
     * 删除班级-学生关联对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteClassStudentByIds(String ids)
    {
        return classStudentMapper.deleteClassStudentByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除班级-学生关联信息
     *
     * @param id 班级-学生关联ID
     * @return 结果
     */
    @Override
    public int deleteClassStudentById(Long id)
    {
        return classStudentMapper.deleteClassStudentById(id);
    }


    @Override
    public int deleteByClassId(Long classId) {
        return classStudentMapper.deleteByClassId(classId);
    }
}
